import React, { useState } from 'react';
import BraftEditor from 'braft-editor'
import 'braft-editor/dist/index.css'
import { Button } from 'antd';

const Index = () => {

  const [htmlStr, setHtmlStr] = useState()

  const handleEditorChange = (editorState) => {
      // console.log(editorState.toHTML());
      setHtmlStr(editorState.toHTML())
  }

  return (
    <div>
      <h3>富文本编辑</h3>
      <Button onClick={()=>{
          console.log(htmlStr);
      }}> 获取输入内容 </Button>
      <BraftEditor onChange={handleEditorChange} />

    </div>
  );
};

export default Index;
